/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.tkgarment.system.domain;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Map;

/**
 *
 * @author zraj
 */
public class Employee {
    
    public static String field_emp_id = "emp_id";
    public static String field_name_th = "name_th";
    public static String field_surname_th = "surname_th";
    public static String field_name_en = "name_en";
    public static String field_surname_en = "surname_en";
    public static String field_status_id = "status_id";
    public static String field_birth_date = "birth_date"; 
    public static String field_sex_id = "sex_id";
    public static String field_emp_type_id = "emp_type_id";
    public static String field_marital_status_id = "marital_status_id";
    public static String field_birth_place = "birth_place";
    public static String field_idcard_number = "idcard_number";
    public static String field_idcard_start_date = "idcard_start";
    public static String field_idcard_end = "idcard_end";
    public static String field_blood_type_id = "blood_type_id";  
    public static String field_workstartdate = "workstartdate";
    public static String field_regis_date = "work_regis_date";
    public static String field_contact_person = "contact_person";
    public static String field_contact_tel = "contact_tel";
    public static String field_graduate_level_id = "graduate_level_id";
    public static String field_gradute_from = "graduate_from";
    public static String field_graduate_year = "graduate_year";
    public static String field_email = "email";
    public static String field_department_id = "department_id";
    public static String field_title_id = "title_id";
    public static String field_nickname = "nickname";
    public static String field_religion_id = "religion_id";
    public static String field_birth_province = "birth_province";
    public static String field_pic_path = "pic_path";   
    public static String field_position_name = "position_name";
    public static String field_company_tel = "company_tel";
    public static String field_gpa = "gpa";
    public static String field_graduate_major = "graduate_major";
    public static String field_nationality_name = "nationality_name"; 
    public static String field_children = "children";
    public static String field_insure_id = "insure_id";
    public static String field_hospital_id = "hostpital_id";
    public static String field_bank_id = "bank_id";
    public static String field_married_id = "married_id";
    public static String field_workenddate = "workend";
    
    public static void mapfield(Map<String, Object> map,Employee e)throws Exception {
        
        SimpleDateFormat dateF = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
        
        if (map.get(field_birth_date) != null ) {
             e.setBirthDate((Date)map.get(field_birth_date));
             
        }
        if (map.get(field_nationality_name) != null) {
            e.setNationallity(map.get(field_nationality_name).toString());
        }
        
        if (map.get(field_birth_place) != null) {
            e.setBirthPlace(map.get(field_birth_place).toString());
        }
        
        if (map.get(field_birth_province) != null) {
            e.setBirthProvince(Integer.parseInt(map.get(field_birth_province).toString()));
        }
        
        if(map.get(field_blood_type_id) != null){
            e.setBloodTypeID(Integer.parseInt(map.get(field_blood_type_id).toString()));
        }
        
        if (map.get(field_company_tel) != null) {
            e.setCompanyTel(map.get(field_company_tel).toString());
        }
        if (map.get(field_contact_person) != null) {
            e.setContactPerson(map.get(field_contact_person).toString());
        }
        if (map.get(field_contact_tel) != null) {
            e.setContactTel(map.get(field_contact_tel).toString());
            System.out.println(e.getContactTel());
        }
        if (map.get(field_department_id) != null) {
            e.setDepartmentID(map.get(field_department_id).toString());
        }
        if (map.get(field_email) != null) {
            e.setEmail(map.get(field_email).toString());
        }
        if (map.get(field_emp_id) != null) {
            e.setEmpId(map.get(field_emp_id).toString());
        }
        
        if (map.get(field_emp_type_id) != null) {
            e.setEmpTypeID(Integer.parseInt(map.get(field_emp_type_id).toString()));
        }
        if (map.get(field_gpa) != null) {
            e.setGpa(map.get(field_gpa).toString());
        }
        if (map.get(field_graduate_level_id) != null) {
            e.setGraduateLevelID(Integer.parseInt(map.get(field_graduate_level_id).toString()));
        }
        if (map.get(field_graduate_major) != null) {
            e.setGraduateMajor(map.get(field_graduate_major).toString());
        }
        
        if (map.get(field_graduate_year) != null) {
            e.setGraduateYear(map.get(field_graduate_year).toString());
        }
        if (map.get(field_gradute_from) != null) {
            e.setGraduateFrom(map.get(field_gradute_from).toString());
        }
        if (map.get(field_idcard_end) != null) {
            e.setIdcardEndDate((Date)map.get(field_idcard_end));
        }
        if (map.get(field_idcard_number) != null) {
            e.setIdcardNumber(map.get(field_idcard_number).toString());
        }
        if (map.get(field_idcard_start_date) != null) {
            e.setIdcardStartDate((Date)map.get(field_idcard_start_date));
        }
        if (map.get(field_marital_status_id) != null) {
            e.setMaritalStatusID(Integer.parseInt(map.get(field_marital_status_id).toString()));
        }
        if (map.get(field_name_en) != null) {
            e.setNameEN(map.get(field_name_en).toString());
        }
        if (map.get(field_name_th) != null) {
            e.setNameTH(map.get(field_name_th).toString());
        }
        if (map.get(field_nickname) != null) {
            e.setNickname(map.get(field_nickname).toString());
        }
        if (map.get(field_pic_path) != null) {
            e.setPicPath(map.get(field_pic_path).toString());
        }
        if (map.get(field_position_name) != null) {
            e.setPositionName(map.get(field_position_name).toString());
        }
        if (map.get(field_regis_date) != null) {
            e.setWorkRegisDate((Date)map.get(field_regis_date));
        }
        if (map.get(field_religion_id) != null) {
            e.setReligionID(Integer.parseInt(map.get(field_religion_id).toString()));
        }
        if (map.get(field_sex_id) != null) {
            e.setSexID(Integer.parseInt(map.get(field_sex_id).toString()));
        }
        if (map.get(field_status_id) != null) {
            e.setStatusID(Integer.parseInt(map.get(field_status_id).toString()));
        }
        if (map.get(field_surname_en)!= null) {
            e.setSurnameEN(map.get(field_surname_en).toString());
        }
        if (map.get(field_surname_th) != null) {
            e.setSurnameTH(map.get(field_surname_th).toString());
        }
        if (map.get(field_title_id) != null) {
            e.setTitleNameID(Integer.parseInt(map.get(field_title_id).toString()));
        }
        if (map.get(field_workstartdate) != null) {
            e.setWorkStartDate((Date)map.get(field_workstartdate));
        }
        
         if (map.get(field_workenddate) != null) {
            e.setWorkEndDate((Date)map.get(field_workenddate));
        }
        
        if (map.get(field_children) != null) {
            e.setChildren(Integer.parseInt(map.get(field_children).toString()));
        }
        
        if (map.get(field_insure_id) != null) {
            e.setInsureId(map.get(field_insure_id).toString());
        }
        
        if (map.get(field_bank_id) != null) {
            e.setBankId(map.get(field_bank_id).toString());
        }
        
        if (map.get(field_married_id) != null) {
            e.setMarriedId(map.get(field_married_id).toString());
            
        }
    }
 
  
    
    private String empId;
    private String nameTH;
    private String surnameTH;
    private String nameEN;
    private String surnameEN;
    private String deptName;
    private Integer statusID;
    private Date birthDate;
    private Integer sexID;
    private Integer empTypeID;
    private Integer maritalStatusID;
    private String idcardNumber;
    private Date idcardStartDate;
    private Date idcardEndDate;
    private Integer bloodTypeID;
    private String nationallity;
    private Date workStartDate;
    private Date workRegisDate;
    private String contactPerson;
    private String contactTel;
    private Integer graduateLevelID;
    private String graduateFrom;
    private String graduateYear;
    private String positionName;
    private String email;
    private String departmentID;
    private Integer titleNameID;
    private String nickname;
    private Integer religionID;
    private Integer birthProvince;
    private String picPath;
    private String companyTel;
    private String gpa;
    private String graduateMajor;
    private String birthPlace;
    private Integer children;
    private String insureId;
    private Integer hospitalId;
    private String bankId;
    private String marriedId;
    private Date workEndDate;

    public Date getWorkEndDate() {
        return workEndDate;
    }

    public void setWorkEndDate(Date workEndDate) {
        this.workEndDate = workEndDate;
    }
    
    

    public Employee() {
    }

    public Integer getChildren() {
        return children;
    }

    public void setChildren(Integer children) {
        this.children = children;
    }

    public String getInsureId() {
        return insureId;
    }

    public void setInsureId(String insureId) {
        this.insureId = insureId;
    }

    public Integer getHospitalId() {
        return hospitalId;
    }

    public void setHospitalId(Integer hospitalId) {
        this.hospitalId = hospitalId;
    }

    public String getBankId() {
        return bankId;
    }

    public void setBankId(String bankId) {
        this.bankId = bankId;
    }

    public String getMarriedId() {
        return marriedId;
    }

    public void setMarriedId(String marriedId) {
        this.marriedId = marriedId;
    }

    
    
    public String getBirthPlace() {
        return birthPlace;
    }

    public void setBirthPlace(String birthPlace) {
        this.birthPlace = birthPlace;
    }
    
    

    public Integer getStatusID() {
        return statusID;
    }

    public void setStatusID(Integer statusID) {
        this.statusID = statusID;
    }

    public Date getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    public Integer getSexID() {
        return sexID;
    }

    public void setSexID(Integer sexID) {
        this.sexID = sexID;
    }

    public Integer getEmpTypeID() {
        return empTypeID;
    }

    public void setEmpTypeID(Integer empTypeID) {
        this.empTypeID = empTypeID;
    }

    public Integer getMaritalStatusID() {
        return maritalStatusID;
    }

    public void setMaritalStatusID(Integer maritalStatusID) {
        this.maritalStatusID = maritalStatusID;
    }

    public String getIdcardNumber() {
        return idcardNumber;
    }

    public void setIdcardNumber(String idcardNumber) {
        this.idcardNumber = idcardNumber;
    }

    public Date getIdcardStartDate() {
        return idcardStartDate;
    }

    public void setIdcardStartDate(Date idcardStartDate) {
        this.idcardStartDate = idcardStartDate;
    }

    public Date getIdcardEndDate() {
        return idcardEndDate;
    }

    public void setIdcardEndDate(Date idcardEndDate) {
        this.idcardEndDate = idcardEndDate;
    }

    public Integer getBloodTypeID() {
        return bloodTypeID;
    }

    public void setBloodTypeID(Integer bloodTypeID) {
        this.bloodTypeID = bloodTypeID;
    }

    public String getNationallity() {
        return nationallity;
    }

    public void setNationallity(String nationallity) {
        this.nationallity = nationallity;
    }

    public Date getWorkStartDate() {
        return workStartDate;
    }

    public void setWorkStartDate(Date workStartDate) {
        this.workStartDate = workStartDate;
    }

    public Date getWorkRegisDate() {
        return workRegisDate;
    }

    public void setWorkRegisDate(Date workRegisDate) {
        this.workRegisDate = workRegisDate;
    }

    public String getContactPerson() {
        return contactPerson;
    }

    public void setContactPerson(String contactPerson) {
        this.contactPerson = contactPerson;
    }

    public String getContactTel() {
        return contactTel;
    }

    public void setContactTel(String contactTel) {
        this.contactTel = contactTel;
    }

    public Integer getGraduateLevelID() {
        return graduateLevelID;
    }

    public void setGraduateLevelID(Integer graduateLevelID) {
        this.graduateLevelID = graduateLevelID;
    }

    public String getGraduateFrom() {
        return graduateFrom;
    }

    public void setGraduateFrom(String graduateFrom) {
        this.graduateFrom = graduateFrom;
    }

    public String getGraduateYear() {
        return graduateYear;
    }

    public void setGraduateYear(String graduateYear) {
        this.graduateYear = graduateYear;
    }

    public String getPositionName() {
        return positionName;
    }

    public void setPositionName(String positionName) {
        this.positionName = positionName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getDepartmentID() {
        return departmentID;
    }

    public void setDepartmentID(String departmentID) {
        this.departmentID = departmentID;
    }

    public Integer getTitleNameID() {
        return titleNameID;
    }

    public void setTitleNameID(Integer titleNameID) {
        this.titleNameID = titleNameID;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public Integer getReligionID() {
        return religionID;
    }

    public void setReligionID(Integer religionID) {
        this.religionID = religionID;
    }

    public String getPicPath() {
        return picPath;
    }

    public void setPicPath(String picPath) {
        this.picPath = picPath;
    }

    public String getCompanyTel() {
        return companyTel;
    }

    public void setCompanyTel(String companyTel) {
        this.companyTel = companyTel;
    }

    public String getGpa() {
        return gpa;
    }

    public void setGpa(String gpa) {
        this.gpa = gpa;
    }

    public String getGraduateMajor() {
        return graduateMajor;
    }

    public void setGraduateMajor(String graduateMajor) {
        this.graduateMajor = graduateMajor;
    }

    public Integer getBirthProvince() {
        return birthProvince;
    }

    public void setBirthProvince(Integer birthProvince) {
        this.birthProvince = birthProvince;
    }
    
    
    
  
    

    public String getEmpId() {
        return empId;
    }

    public void setEmpId(String empId) {
        this.empId = empId;
    }

    public String getNameTH() {
        return nameTH;
    }

    public void setNameTH(String nameTH) {
        this.nameTH = nameTH;
    }

    public String getSurnameTH() {
        return surnameTH;
    }

    public void setSurnameTH(String surnameTH) {
        this.surnameTH = surnameTH;
    }

    public String getNameEN() {
        return nameEN;
    }

    public void setNameEN(String nameEN) {
        this.nameEN = nameEN;
    }

    public String getSurnameEN() {
        return surnameEN;
    }

    public void setSurnameEN(String surnameEN) {
        this.surnameEN = surnameEN;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    
    
    
}
